package com.ibm.ops;

import java.util.ArrayList;
import java.util.List;

import com.ibm.ops.domain.OpsAuditLogMetaData;

final class OpsAuditLogStore {

	private List<OpsAuditLogMetaData> store = null;
	
	private List<OpsAuditLogStoreListener> listeners = null;
	
	OpsAuditLogStore(){
		this.store = new ArrayList<OpsAuditLogMetaData>();
		this.listeners = new ArrayList<OpsAuditLogStoreListener>();
	}

	public List<OpsAuditLogMetaData> getStore() {
		return store;
	}
	
	public void addOpsAuditLogMetaData(OpsAuditLogMetaData log){
		if(this.store != null){
			this.store.add(log);
			for(int i = 0; i < listeners.size(); i++){
				listeners.get(i).onAddAuditLogMeta(log);
			}
		}
	}
	
	public void registerOpsLogStoreListener(OpsAuditLogStoreListener listener){
		if(listener != null){
			this.listeners.add(listener);
		}
	}
}
